import request from '@/utils/request'

const api_name = '/admin/product/product'
// 分页列表
export function GetProductPageList(page, limit, queryDto) {
  return request({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
    params: queryDto,
  })
}

// 保存信息
export function SaveProduct(product) {
  return request({
    url: `${api_name}/portductAdd`,
    method: 'post',
    data: product,
  })
}

// 修改信息
export function UpdateProductById(product) {
  return request({
    url: `${api_name}/productUpdate`,
    method: 'put',
    data: product,
  })
}

// 根据id删除信息

export function DeleteProductById(id) {
  return request({
    url: `${api_name}/productDelete/${id}`,
    method: 'delete',
  })
}

// 根据id获取信息
export function GetProductById(id) {
  return request({
    url: `${api_name}/productFindOne/${id}`,
    method: 'get',
  })
}

// 审核

export function UpdateProductAuditStatus(id, auditStatus) {
  return request({
    url: `${api_name}/updateAuditStatus/${id}/${auditStatus}`,
    method: 'get',
  })
}

// 上下架

export function UpdateProductStatus(id, status) {
  return request({
    url: `${api_name}/updateStatus/${id}/${status}`,
    method: 'get',
  })
}
